<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Element Steps审批流程</title>
  <!-- 引入Element UI样式 -->
  <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
  <style>
    body {
      font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
      background-color: #f5f7fa;
      padding: 20px;
    }
    .approval-container {
      max-width: 800px;
      margin: 0 auto;
      background: #fff;
      padding: 30px;
      border-radius: 4px;
      box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    }
    h2 {
      text-align: center;
      margin-bottom: 30px;
      color: #303133;
    }
    .step-controls {
      margin-top: 40px;
      display: flex;
      justify-content: center;
      gap: 15px;
      flex-wrap: wrap;
    }
    .time-info {
      margin-top: 20px;
      padding: 15px;
      background: #f5f7fa;
      border-radius: 4px;
    }
  </style>
</head>
<body>
  <div id="app">
    <div class="approval-container">
      <h2>审批流程状态</h2>
      
      <!-- Element Steps步骤条 -->
      <el-steps :active="activeStep" finish-status="success" align-center>
        <el-step title="开始" :description="formatTime(startTime)"></el-step>
        <el-step title="处理中" :description="formatTime(processingTime)"></el-step>
        <el-step title="已处理" :description="formatTime(processedTime)"></el-step>
      </el-steps>
      
      <div class="time-info">
        <p v-if="activeStep >= 1">事件上报时间: {{ formatTime(startTime) }}</p>
        <p v-if="activeStep >= 2">处理中时间: {{ formatTime(processingTime) }}</p>
        <p v-if="activeStep >= 3">处理完成时间: {{ formatTime(processedTime) }}</p>
      </div>
      
      <div class="step-controls">
        <el-button 
          @click="setStatus('start')" 
          :disabled="activeStep > 0"
          type="primary">
          开始流程
        </el-button>
        <el-button 
          @click="setStatus('processing')" 
          :disabled="activeStep !== 1"
          type="warning">
          标记为处理中
        </el-button>
        <el-button 
          @click="setStatus('processed')" 
          :disabled="activeStep !== 2"
          type="success">
          标记为已处理
        </el-button>
        <el-button @click="resetStatus" type="info">重置流程</el-button>
      </div>
    </div>
  </div>

  <!-- 引入Vue和Element UI -->
  <script src="https://unpkg.com/vue@2/dist/vue.js"></script>
  <script src="https://unpkg.com/element-ui/lib/index.js"></script>
  
  <script>
    new Vue({
      el: '#app',
      data() {
        return {
          activeStep: 0,
          startTime: null,
          processingTime: null,
          processedTime: null
        }
      },
      methods: {
        setStatus(status) {
          const now = new Date();
          switch(status) {
            case 'start':
              this.activeStep = 1;
              this.startTime = now;
              break;
            case 'processing':
              this.activeStep = 2;
              this.processingTime = now;
              break;
            case 'processed':
              this.activeStep = 3;
              this.processedTime = now;
              break;
          }
        },
        resetStatus() {
          this.activeStep = 0;
          this.startTime = null;
          this.processingTime = null;
          this.processedTime = null;
        },
        formatTime(time) {
          if (!time) return '待处理';
          return time.toLocaleString();
        }
      }
    })
  </script>
</body>
</html>